<?LassoScript 
	// this section can be reworked for any database-driven content when no engine controller file is found
	// below is an example of one possible scenarion that finds legacy pages
	// the incoming url is used as a key to render the desired content

	var('currentPath') = $er_dir+'/_app/'+$navString+'/';
	
	er_stripXSS($navString);

	if($enableLegacyPages == 1);
	// CHECK THE LEGACY URL TABLE if set to 1 in globals

	var('sql'='
		SELECT *
		FROM 
			legacypages
		WHERE 
			url = "' + $navString + '";');
	
		inline($connection, -MaxRecords=1, -SQL=$sql);
			er_error;
	
			if(found_count != 0);
				Redirect_URL($domain+'/'+field('newurl'), -Type='Moved');
			/if;
		
	
		/inline;	
	/if;

	var('sql'='
		SELECT 
			reDirectTo, content, title, templateID
		FROM 
			pages
		WHERE 
			urlPathName = "' + $navString + '";');
		
			inline($connection, -MaxRecords=1, -SQL=$sql);
						
			// picks a template in /_conf/lib/templates
			var('useLayout' = field('templateID'));
			
			//er_error;
				var('found'=found_count);
				if($found == 0);
					//redirect_url:$domain;
					// show a not found error
					include($defaultErrorDisplay);
				else;
				
					if(field('reDirectTo') != '');
						redirect_url(field('redirectTo'));
					else;
						var('layout'=process(field('content')));
						var('ptitle'=field('title'));
						$layout;
					/if;
				/if;
			/inline;	
	
?>